<template>
	<view class="page_">
		<pageheader :setting="settingdata"></pageheader>
		<go-top :scrollTop="scrollTop"></go-top>
		<view class="kingstation">
			<view class="typebox">
				<view :class="type==1?'typeone typeon':'typeone'" @click="activechange(1)">月榜</view>
				<view :class="type==2?'typetwo typeon':'typetwo'" @click="activechange(2)">总榜</view>
			</view>
			<view class="king_three" v-if="list.length>0">
				<navigator :url="'/home/station/stationpage?id='+list[1].client_uid" hover-class="none"
					class="kings king_1" v-if="list[1]">
					<image :src="'/static/img/h1.png'" mode="aspectFill" class="heads_top"></image>
					<image :src="'/static/img/d1.png'" mode="aspectFill" class="heads_bottom"></image>
					<view class="heads">
						<image :src="list[1].image" mode="aspectFill" class="headimage"></image>
					</view>
					<text class="clamp1">{{list[1].shop_name}}</text>
					<view class="king_city clamp1">{{list[1].address}}</view>
					<view class="king_des clamp2">{{list[1].business}}</view>
					<view class="king_sales">已售<text>{{list[1].sales}}单</text></view>
				</navigator>
				<view class="kings" v-else></view>
				<navigator :url="'/home/station/stationpage?id='+list[0].client_uid" hover-class="none"
					class="kings king_2" v-if="list[0]">
					<image :src="'/static/img/h2.png'" mode="aspectFill" class="heads_top"></image>
					<image :src="'/static/img/d2.png'" mode="aspectFill" class="heads_bottom"></image>
					<view class="heads">
						<image :src="list[0].image" mode="aspectFill" class="headimage"></image>
					</view>
					<text class="clamp1">{{list[0].shop_name}}</text>
					<view class="king_city clamp1">{{list[0].address}}</view>
					<view class="king_des clamp2">{{list[0].business}}</view>
					<view class="king_sales">已售<text>{{list[0].sales}}单</text></view>
				</navigator>
				<view class="kings" v-else></view>
				<navigator :url="'/home/station/stationpage?id='+list[2].client_uid" hover-class="none"
					class="kings king_3" v-if="list[2]">
					<image :src="'/static/img/h3.png'" mode="aspectFill" class="heads_top"></image>
					<image :src="'/static/img/d3.png'" mode="aspectFill" class="heads_bottom"></image>
					<view class="heads">
						<image :src="list[2].image" mode="aspectFill" class="headimage"></image>
					</view>
					<text class="clamp1">{{list[2].shop_name}}</text>
					<view class="king_city clamp1">{{list[2].address}}</view>
					<view class="king_des clamp2">{{list[2].business}}</view>
					<view class="king_sales">已售<text>{{list[2].sales}}单</text></view>
				</navigator>
				<view class="kings" v-else></view>
			</view>
		</view>
		<view class="not_more" v-if="list.length<1">
			<image src="../../static/img/wdizhi.png" mode="widthFix"></image>
			<view class="text">暂无门店</view>
		</view>
		<block v-for="(item,index) in list" :key="index">
			<navigator :url="'/home/station/stationpage?id='+item.client_uid" hover-class="none" class="top_one"
				v-if="index>2">
				<text class="top_number">{{index+4}}</text>
				<image :src="item.image" mode="aspectFill"></image>
				<view class="top_info">
					<text class="top_name clamp1">{{item.shop_name}}</text>
					<view class="top_des">
						<text class="des_city">{{item.address}}</text>
						<view class="des_numbers">
							已售<text>{{item.sales}}</text>单
						</view>
					</view>
					<view class="clamp1 top_sale">{{item.business}}</view>
				</view>
			</navigator>
		</block>
		<navigator url="/home/index/ten" open-type="redirect" hover-class="none" class="toten">
			<text>地区</text>
			<text>十强</text>
		</navigator>
	</view>
</template>

<script>
	var _this, $paginator;
	export default {
		data() {
			return {
				settingdata: {
					name: '全国百强',
					bgColor: '#fff',
					titleColor: '#000000',
					showNav: true,
					showTypes: 0,
					position: "reading"
				},
				list: [],
				type: 1,
				// 回到头部按钮距离
				scrollTop: 0,
			}
		},

		onLoad(options) {
			_this = this
			if (options.showTypes == 1) {
				wx.setStorageSync("share", false)
				_this.settingdata.showTypes = 1
			}
			_this.getdata()
		},
		//监听页面滚动
		onPageScroll(res) {
			this.scrollTop = res.scrollTop
		},
		methods: {

			// 获取数据
			getdata() {
				_this.$api.get("sortorder", {
					select_type: 2,
					city: uni.getStorageSync("address").city,
					tab_type: _this.type,
				}).then(data => {
					_this.list = data
				});
			},

			activechange: function(_index) {
				_this.type = _index
				_this.getdata()
			},

			onShareAppMessage() {
				let url = '/home/index/hundred?showTypes=1'
				return {
					path: url
				}
			},
			onShareTimeline() {
				return {
					path: 'showTypes=1'
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.page_ {
		margin: 0 25rpx;
		position: relative;

		.kingstation {
			width: 100%;
			padding-bottom: 45rpx;
			background-color: #f2f2f2;
			border-radius: 20rpx;
			display: flex;
			flex-direction: column;
			align-items: center;

			.typebox {
				display: flex;
				flex-direction: row;
				align-items: center;
				width: 448rpx;
				border-radius: 30rpx;
				height: 59rpx;
				margin-top: 27rpx;

				.typeone {
					width: 50%;
					text-align: center;
					line-height: 59rpx;
					color: #999999;
					font-size: 28rpx;
					border: 2rpx solid #CDCDCD;
					background-color: #f2f2f2;
					border-radius: 30rpx 0 0 30rpx;
					border-right: none;
				}

				.typetwo {
					width: 50%;
					text-align: center;
					line-height: 59rpx;
					color: #999999;
					font-size: 28rpx;
					border: 2rpx solid #CDCDCD;
					background-color: #f2f2f2;
					border-radius: 0 30rpx 30rpx 0;
					border-left: none;
				}

				.typeon {
					background-color: #fff;
					color: #333;
				}
			}

			.king_three {
				margin-top: 72rpx;
				display: flex;
				flex-direction: row;
				align-items: center;
				justify-content: space-between;

				.kings {
					display: flex;
					flex-direction: column;
					align-items: center;
					width: 180rpx;
					position: relative;

					.heads {
						width: 115rpx;
						height: 115rpx;
						position: relative;

						.headimage {
							width: 100%;
							height: 100%;
							border-radius: 50%;
						}
					}

					.heads_top {
						width: 64rpx;
						height: 60rpx;
						position: absolute;
						top: -46rpx;
						left: 38rpx;
					}

					.heads_bottom {
						width: 180rpx;
						height: 56rpx;
						position: absolute;
						top: 84rpx;
						z-index: 9;
					}

					text {
						margin-top: 34rpx;
						color: #222222;
						font-size: 30rpx;
						font-weight: bold;
						text-align: center;
						width: 100%;
					}

					.king_city {
						margin-top: 13rpx;
						color: #383838;
						font-size: 24rpx;
						width: 100%;
						text-align: center;
					}

					.king_des {
						width: 100%;
						color: #666666;
						font-size: 22rpx;
						margin-top: 15rpx;
					}

					.king_sales {
						margin-top: 14rpx;
						font-size: 24rpx;
						color: #666666;
						width: 100%;
						text-align: center;

						text {
							color: #F73F3F;
							font-size: 24rpx;
						}
					}
				}

				.king_1 {
					margin-top: 50rpx;

					.headimage {
						border: 4rpx solid #aab8c6;
					}
				}

				.king_3 {
					margin-top: 50rpx;

					.headimage {
						border: 4rpx solid #faad61;
					}
				}

				.king_2 {
					margin: -30rpx 34rpx 0 34rpx;

					.headimage {
						border: 4rpx solid #ff6766;
					}
				}
			}
		}

		.top_one {
			padding: 33rpx 26rpx 33rpx 18rpx;
			border-bottom: 2rpx solid #e6e6e6;
			display: flex;
			flex-direction: row;
			align-items: center;

			.top_number {
				color: #333333;
				font-size: 36rpx;
				font-weight: bold;
			}

			image {
				width: 115rpx;
				height: 115rpx;
				border-radius: 50%;
				margin-left: 27rpx;
			}

			.top_info {
				margin-left: 30rpx;
				display: flex;
				flex-direction: column;
				max-width: 466rpx;

				.top_name {
					color: #333333;
					font-size: 36rpx;
				}

				.top_des {
					margin-top: 15rpx;
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: space-between;

					.des_city {
						color: #999999;
						font-size: 28rpx;
					}

					.des_numbers {
						color: #999999;
						font-size: 24rpx;

						text {
							color: #F73F3F;
						}
					}
				}

				.top_sale {
					margin-top: 17rpx;
					color: #999999;
					font-size: 28rpx;
				}
			}
		}

		.toten {
			width: 100rpx;
			height: 100rpx;
			border-radius: 50%;
			background-color: #38BE8C;
			box-shadow: 0 0 35rpx 0 rgba(56, 190, 140, 0.3);
			position: fixed;
			bottom: 100rpx;
			right: 40rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			flex-direction: column;

			text {
				color: #fff;
				font-size: 30rpx;
			}
		}
	}
</style>
